﻿<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
    <%@page import="global.Constants"%>
    <%@page import="com.aiflow.Action.DepartmentAction"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title>
	<script type="text/javascript">
	    //这里的全局是为了修改之后的刷新
	    var superviseRankingListGrid;
	    var superviseRankingListStore;
		$(document).ready(function(){
			 // 全局参数
			var baseParams = {limit:<%=Constants.PAGE_SIZE %>,start : 0,region:''};
			var EXT_QUERY_TIME_OUT = 1200000;

			// 工单语音统计  userName,u.telep ,d.name as targetName
		    superviseRankingListStore = new Ext.data.JsonStore({
		        url: '${pageContext.request.contextPath}/findSuperviseRecordInfo.action',
		        root: 'datas',
				timeout : EXT_QUERY_TIME_OUT,
		        totalProperty: 'results',
		        fields: ['分公司','总数量','成功数量','失败数量','未接听至少3次的','未接听1到2次的','未接听0次的'],
		        baseParams: baseParams,
		        autoLoad: true,
				listeners : {  
          load : function() {  
              isDetailReady = true;// 查询置换标志为已查过   
            }  
            }  
		    });
		    
		    // 区域  数据源  getDepartmentCombo
	          var regionStore = new Ext.data.ArrayStore({  
	            fields : ['region_id', 'region_name'],  
	            data : <%=DepartmentAction.getDepartmentNameCombo("1")%>,
	            sortInfo: {field: "region_id", direction: "ASC"}
	        });
		    
		   // 工具栏
		   var superviseRankingListToolbar = new Ext.Toolbar({
		    	renderTo: 'superviseRankingListToolbarDiv',
		    	items: [
		    	     '查询：','区域',
					{  
			                xtype:'combo',
			                id:'regionn',
			                hiddenName: 'region',
			                fieldLabel: '省市',
			                store: regionStore,
			                mode : 'local',
			                triggerAction: "all",
			                valueField: 'region_id',
			                displayField: 'region_name',
			                allowBlank:true,
			                editable: false,
			                width: 100,
			                anchor:'98%'
			           },
		             new Ext.Button({
					    id: 'send-query-button',
					    text: '查询',
						iconCls: 'magnifier'
					})
				]
			});
 
			// 数据表格    dept_name spec
			var sm = new Ext.grid.CheckboxSelectionModel();
			superviseRankingListGrid = new Ext.grid.EditorGridPanel({
				id: 'superviseRankingListGrid',
				renderTo: 'superviseRankingListGridDiv',
				border: false,
				stateful: true,
			    autoScroll: 'auto',
		        store: superviseRankingListStore,
		        loadMask: true,
		        cm: new Ext.grid.ColumnModel({
		            defaults: {
		                width: 100,
		                sortable: true
		            },
			        columns: [
						sm,
						new Ext.grid.RowNumberer({header:'№',width:20}),
						{id:'分公司',header: '分公司', width: 130, hidden: false, sortable: true , dataIndex: '分公司'},
			            {id:'总数量',header: '总数量', width: 80,hidden: false, sortable: true, dataIndex: '总数量'},
			            {id:'成功数量',header: '成功数量', width: 100,hidden: false, sortable: true, dataIndex: '成功数量'},
			            {id:'失败数量',header: '失败数量', width: 120,hidden: false, sortable: true, dataIndex: '失败数量'},
                        {id:'未接听至少3次的',header: '未接听至少3次的', width: 140,hidden: false, sortable: true, dataIndex: '未接听至少3次的'},
			            {id:'未接听1到2次的',header: '接听1到2次的', width:140,hidden: false, sortable: true, dataIndex: '未接听1到2次的'},
			            {id:'未接听0次的',header: '未接听0次的', width:120,hidden: false, sortable: true, dataIndex: '未接听0次的'}
			             ]
		        }),
		        sm: sm,
		        columnLines: true,
		         bbar: new Ext.PagingToolbar({
					pageSize: <%=Constants.PAGE_SIZE %>,
					store: superviseRankingListStore,
					displayInfo: true,
					displayMsg: Anynote.PAGINGTOOLBAR_DISPLAYMSG,
					emptyMsg: Anynote.PAGINGTOOLBAR_EMPTYMSG,
					doLoad: function(start){
						baseParams.start = start;
						var reg = Ext.getCmp("regionn").getValue();
						baseParams.region = reg;
						this.store.load({params: baseParams});
					}
		        })
		    });
			// 设置Grid高度和宽度
		    Anynote.resizeGridTo("superviseRankingListGrid", 0, 56);
		})  
           
			 $("#send-query-button").click(function(){
			     var basePar  = {limit:<%=Constants.PAGE_SIZE %>,start : 0};
			       var reg = Ext.getCmp("regionn").getValue();
			       basePar.region = reg;
			       superviseRankingListStore.reload({params:basePar});
			 })
	</script>
</head>
<body>
<div id="superviseRankingListDiv">
	<div id="superviseRankingListToolbarDiv"></div>
	<div id="superviseRankingListGridDiv" style="width:100%;height:100%;"></div>
</div>
</body>
</html>